package gr.unipi.mscd1;

public class DvInfo extends SnmpGenInfo {
	private int id;
	private String descr;
	private int type;
	private int state;
	
	public DvInfo() {
		super();
		id = 0;
		descr = "";
		type = 0;
		state = 0;
	}

	public DvInfo(int id, String descr, int type, int state) {
		super();
		this.id = id;
		this.descr = descr;
		this.type = type;
		this.state = state;
	}
	
	public DvInfo(DeviceInfo info) {
		super();
		this.id = (Integer)info.getOids().get(0).getValue();
		String typeTmp = (String)info.getOids().get(1).getValue();
		int from = typeTmp.lastIndexOf(".");
		this.type = Integer.parseInt(typeTmp.substring(from + 1));
		this.descr = (String)info.getOids().get(2).getValue();
		this.state = (Integer)info.getOids().get(3).getValue();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescr() {
		return descr;
	}

	public void setDescr(String descr) {
		this.descr = descr;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}
	
	public String getStateDescr() {
		if (!devStatusDescr.containsKey(state)) {
			return state + "(" + state + ")";
		}
		return devStatusDescr.get(state) + "(" + state + ")";
	}
	
	public String getTypeDescr() {
		if (!devTypeDescr.containsKey(type)) {
			return type + "";
		}
		return devTypeDescr.get(type) + "(" + type + ")";
	}
	
}
